package com.kyle.redpacket.dto.result;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.ToString;

/**
 * Simple to Introduction
 *
 * @ProjectName: [demo]
 * @Description: [结果错误]
 * @Author: [Kyle]
 * @CreateDate: [2018-08-16 13:22]
 * @UpdateUser: [Kyle]
 * @UpdateDate: [2018-08-16 13:22]
 * @UpdateRemark: [说明本次修改内容]
 * @Version: [1.0]
 */
@ToString
@JsonIgnoreProperties({"stackTrace"})
public class ResultException extends RuntimeException {
    private final ResultEnum resultEnum;

    public ResultEnum getResultEnum() {
        return resultEnum;
    }

    public ResultException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.resultEnum = resultEnum;
    }

    public ResultException(ResultEnum resultEnum, Throwable throwable) {
        super(resultEnum.getMsg(), throwable);
        this.resultEnum = resultEnum;
    }

    public ResultException(String message, Throwable parent) {
        super(message, parent);
        this.resultEnum = ResultEnum.UNKONW_ERROR;
    }

    public ResultException(String message) {
        super(message);
        this.resultEnum = ResultEnum.UNKONW_ERROR;
    }

    public ResultException(Throwable t) {
        super(t);
        this.resultEnum = ResultEnum.UNKONW_ERROR;
    }
}
